<?php
	session_start();
	include('conn.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Applied Biological Materials Inc.</title>
</head>
<body>
<?php
	import_request_variables('pg','v_');
	if (isset($v_cn)){
		$param="?cn=$v_cn&";
	}else{
		$param="?";
	}
	$csn=$v_csn;
	$ssn=$v_ssn;
	$sid=$_SESSION['id'];
	$param .="csn=$csn&ssn=$ssn";
	if (isset($dsn)){
		$param .="&dsn=$dsn";
	}
	if (isset($pcat)){
		$param .="&pcat=$pcat";
	}
	switch ($op){
		case "1" :
			echo "<script type=text/javascript>location.href='cart-change.php$param';</script>";
			break;
		case "2":
			switch ($csn){
				case "8" :
					echo "<script type=text/javascript>
							if (confirm('Empty the shopping cart?')){
								location.href='delShoplist.php$param';
							}else{
								location.href='ProdList-menu.php$param';
							}
						  </script>";
					 break;
					 
				case "9" :
					echo "<script type=text/javascript>
							if (confirm('Empty the shopping cart?')){
								location.href='delShoplist.php$param';
							}else{
								location.href='siRNAProdList-main.php$param';
							}
						  </script>";
					 break;
					 
				case "10" :
					echo "<script type=text/javascript>
							if (confirm('Empty the shopping cart?')){
								location.href='delShoplist.php$param';
							}else{
								location.href='LentiProdList-main.php$param';
							}
						  </script>";
					 break;
					 
				case "11" :
					echo "<script type=text/javascript>
							if (confirm('Empty the shopping cart?')){
								location.href='delShoplist.php$param';
							}else{
								location.href='AdenoProdList-main.php$param';
							}
						  </script>";
					 break;
				
				case "12" :
					if (isset($pcat) && $pcat=='18'){
						echo "<script type=text/javascript>
								if (confirm('Empty the shopping cart?')){
									location.href='delShoplist.php?cn=8&csn=18&ssn=$ssn';
								}else{
									location.href='./LoadingControl/dispList.php?cn=8&csn=12&ssn=$ssn';
								}
							  </script>";
						break;
					}
				case "13" :
					echo "<script type=text/javascript>
							if (confirm('Empty the shopping cart?')){
								location.href='delShoplist.php$param';
							}else{
								location.href='./moreproduct/ProdList-menu.php$param';
							}
						  </script>";
					break;
					
				case "14" :
					echo "<script type=text/javascript>
							if (confirm('Empty the shopping cart?')){
								location.href='delShoplist.php$param';
							}else{
								location.href='./viralexp/Adeno1.php$param';
							}
						  </script>";
					break;
					
				case "2" :
					echo "<script type=text/javascript>
							if (confirm('Empty the shopping cart?')){
								location.href='delShoplist.php$param';
							}else{
								location.href='./TagAntibody/dispList.php$param';
							}
						  </script>";
					break;
					
				case "19" :
					echo "<script type=text/javascript>
							if (confirm('Empty the shopping cart?')){
								location.href='delShoplist.php$param';
							}else{
								location.href='./moreproduct/ProdList-menu.php$param';
							}
						  </script>";
					break;
					
				case "29" :
					echo "<script type=text/javascript>
							if (confirm('Empty the shopping cart?')){
								location.href='delShoplist.php$param';
							}else{
								location.href='./IHC/ProdList.php$param';
							}
						  </script>";
					break;
					
				case "30" :
					echo "<script type=text/javascript>
							if (confirm('Empty the shopping cart?')){
								location.href='delShoplist.php$param';
							}else{
								location.href='./StemCell/ProdList.php$param';
							}
						  </script>";
					break;
					
				case "43" :
					echo "<script type=text/javascript>
							if (confirm('Empty the shopping cart?')){
								location.href='delShoplist.php$param';
							}else{
								location.href='./PrimaryCells/ProdList.php$param';
							}
						  </script>";
					break;
					
				case "44" :
					echo "<script type=text/javascript>
							if (confirm('Empty the shopping cart?')){
								location.href='delShoplist.php$param';
							}else{
								location.href='./ProteinPurification/index.php$param';
							}
						  </script>";
					break;
					
					
				default:
					echo "<script type=text/javascript>
							if (confirm('Empty the shopping cart?')){
								location.href='delShoplist.php$param';
							}else{
								location.href='ProdList-menu.php$param';
							}
						  </script>";
			}

		case "3":
			
			/*if (!isset($_SESSION['list'])){
				$_SESSION['list']="";
			}
			
			if (!isset($_SESSION['total'])){
				$_SESSION['total']=0.00;
			}
			
			$sql="select * from shoplist where sessionid='$sid' group by catNo";
			$res=mysql_query($sql,$db);
			$rows=mysql_num_rows($res);
			if ($rows>0){
				$lst="";
				$total=0.00;
				while ($r=mysql_fetch_array($res)){
					$lst.=$r['catNo']."[".$r['quantity']."]"."; ";
					$total+=$r['quantity']*$r['price'];
				}
			}else{
				$lst="";
				$total=0.00;
			}
			$total=round($total,2);
			$_SESSION['list']=$lst;
			$_SESSION['total']=$total;
			
			echo "<script language=javascript>location.href='chkacnt.php';</script>";
			exit;
			/*cut off the inventory quantity.
			$sql="select * from shoplist where sessionid='$sid' group by catNo";
			$res=mysql_query($sql,$db);
			$rows=mysql_num_rows($res);
			if ($rows>0){
				while ($r=mysql_fetch_array($res)){
					$catNo=$r['catNo'];
					$quantity=$r['quantity'];
					$cutoff_inven="update flyers set quantity=quantity-'$quantity' where catNo='$catNo'";
					$cutoff_res=mysql_query($cutoff_inven,$db);
				}
			}//end cut off.
			*/

			
			/*$del_shoplist="delete from shoplist where sessionid='$sid'";
			//$res_shoplist=mysql_query($del_shoplist,$db);
			//echo "<script type=text/javascript>location.href='https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=onlineordering@bowersmedical.com&item_name=Order List: $lst&amount=$total&no_note=1&currency_code=CAD';</script>";
			exit;*/
	}	
?>
</body>
</html>